<?php

namespace Bmb\EventBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class VoteType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('votName', 'text', array(
										'attr' => array(
											'placeholder' => 'Votre nom',
										)))
            ->add('votEmail', 'text', array('required' => false, 'attr' => array(
												'placeholder' => 'Votre email (facultatif)',
										)))
            ->add('votDate', 'text', array('required' => true, 'attr' => array(
												'placeholder' => 'Date de naissance du bébé (jj/mm/yyyy)',
												'autocomplete' => 'off'
										)))
            ->add('votGender', 'choice', array('required' => true,
												'choices' => array('f' => 'Fille', 'm' => 'Garçon'),
												'attr' => array(
													'placeholder' => 'Sexe',
													'autocomplete' => 'off'
										)))
            ->add('votWeight', 'text', array('required' => true, 'attr' => array(
												'data' => '3.5',
												'readonly' => true
										)))
            ->add('votSize', 'text', array('required' => true, 'attr' => array(
												'data' => '40',
												'readonly' => true
										)))
        ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Bmb\EventBundle\Entity\Vote'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'bmb_eventbundle_vote';
    }
}
